<?php
class Hydrum_Module
{
    protected $_config;
    protected $_code;
    protected $_pathfinder;

    public function __construct($code, Zend_Config $config)
    {
        $this->_config = $config;
        $this->_code = $code;

        $path = 'Module' . DS . Hydrum_Application::formatCode($this->_code);

        $this->_pathfinder = Hydrum::getResource('pathfinder')->find($path);
    }

    public function getPathfinder($relative = '')
    {
        return $this->_pathfinder;
    }

    public function getModelConfig($model)
    {
        $config = null;

        $models = $this->_config->get('models');

        if ($models && is_object($models) && $models->get($model)) {

            $config = $models->get($model);
        }
        
        return $config;
    }
}
